<?php
/* 
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
function doLogin($username,$password){
	mysql_select_db($GLOBALS['database_conn'],$GLOBALS['conn']);
	$query_rs_login= sprintf("select * from admin_user
     WHERE username = %s and user_password =%s",GetSQLValueString($username, "text"),GetSQLValueString($password, "text"));
	return processQuery($query_rs_login);
}
if(isset($_POST['loginfrm']))
{
	 $us= $_POST['username'];
	 $psd= $_POST['password'];
	 $rs_user = doLogin($us,md5($psd));
	 if(mysql_num_rows($rs_user)>0)
	 {
		 $row_user = mysql_fetch_assoc($rs_user);
		 registerSessions($row_user["username"],$row_user["accesslevel"],$row_user["userid"]);
	  }else
	 {
	  $ERROR_MESSAGE ="<div class='errors redtxt'><h2>Error</h2><span class='normal'>Wrong Username and password. Please Check your Caps Lock</span></div>";
	}
}
?>
